﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections.Specialized;
using MVCPets.Helpers;

namespace MVCPets.Extensions
{
  public static class IEnumerableExtensions
  {
    public static void ForEach<T>(this IEnumerable<T> data, Action<T> Action)
    {
      foreach (var item in data) Action(item);
    }

    #region join for strings
    /// <summary>
    /// Joins a collection of strings with the specified separator
    /// </summary>
    /// <param name="input"></param>
    /// <param name="separator"></param>
    /// <returns>String</returns>
    public static string Join(this IEnumerable<string> input, string separator = ",")
    {
      return string.Join(separator, input.ToArray());
    }
    #endregion
  }
}